<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            width: 300px;
            height: 300px;
            background-color: red;
        }
        .inner{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="inner"></div>
    </div>
    <script>
        // 一、over 和 out 来绑定事件 : 会在绑定事件的子元素上触发 ；
        // var outerEle = document.querySelector(".outer");
        // outerEle.onmouseover = function(){
        //     console.log("覆盖了");
        // }

        // outerEle.onmouseout = function(){
        //     console.log("离开了");
        // }

        // 二、enter和leave 来绑定事件：不会在绑定元素的子元素上触发事件；
        var outerEle = document.querySelector(".outer");
        outerEle.onmouseenter = function(){
            console.log("进入了");
        }

        outerEle.onmouseleave = function(){
            console.log("离开了");
        }

    </script>
</body>
</html>